#include <iostream>
#include <stdio.h>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <stack>

using namespace std;

const double PI = acos(-1.0);
const double eps = 1e-6;
const double INF = 1e9 + 7;



int largestRectangleArea(int* height, int length) {
	stack<int> stk;
	int i = 0;
	int maxArea = 0;
	while (i < length){
		if (stk.empty() || height[stk.top()] <= height[i]){
			stk.push(i++);
		}
		else {
			int t = stk.top();
			stk.pop();
			int area = height[t] * (stk.empty() ? i : i - stk.top() - 1);
			maxArea = maxArea > area ? maxArea : area;
		}
	}
	return maxArea;
}


int main()
{
	freopen("data.in", "r", stdin);

	int n, m;

	cin >> n >> m;

	if (n == 0 && m == 0)
	{
		cout << 0 << endl;
		return 0;
	}
	vector<int> row(m, 0);
	vector<vector<int> > matrix(n, row);


	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			cin >> matrix[i][j];
		}
	}

	int** dp = new int*[n];
	for (int i = 0; i < n; ++i){
		dp[i] = new int[m + 1];
		memset(dp[i], 0, sizeof(int)*(m + 1));
	}


	for (int j = 0; j < m; ++j)
	if (matrix[0][j] == 1)
		dp[0][j] = 1;

	for (int j = 0; j < m; ++j)
	for (int i = 1; i < n; ++i)
	if (matrix[i][j] == 1)
		dp[i][j] = dp[i - 1][j] + 1;

	int maxarea = 0;
	for (int i = 0; i < n; ++i){
		int tmp = largestRectangleArea(dp[i], m + 1);
		if (tmp > maxarea)
			maxarea = tmp;
	}

	cout << maxarea << endl;

	for (int i = 0; i < m; ++i)
		delete[] dp[i];
	delete[] dp;




	system("pause");
	return 0;
}